home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / pc / explorer / wave.dxr / 00100.ls < prev    next >
Encoding:
Text File  |  1997-07-22  |  1.3 KB  |  47 lines

  1. on mouseUp
  2.   set the trails of sprite 19 to 1
  3.   if the foreColor of sprite 19 >= 6 then
  4.     set the foreColor of sprite 19 to 0
  5.   else
  6.     set the foreColor of sprite 19 to the foreColor of sprite 19 + 1
  7.   end if
  8.   updateStage()
  9.   if field "A" > 4 then
  10.     put 4 into field "A"
  11.   end if
  12.   if field "A" < -4 then
  13.     put -4 into field "A"
  14.   end if
  15.   if field "B" > 10 then
  16.     put 10 into field "B"
  17.   end if
  18.   if field "B" < 0 then
  19.     put 1 into field "B"
  20.   end if
  21.   set x0 to the locH of sprite 12 + 1
  22.   set y0 to the locV of sprite 12
  23.   set period to float(field "B")
  24.   if the hilite of cast "Degrees" then
  25.     set phase to float(field "C" * PI / 180.0)
  26.   else
  27.     set phase to field "C"
  28.   end if
  29.   repeat with n = 0 to 240
  30.     set the locH of sprite 19 to (2.39999999999999991 * n) + x0
  31.     if the hilite of cast "Sine" then
  32.       set the locV of sprite 19 to y0 - (field "A" * 50.0 * float(sin((float(period * n * 3.0) * PI / 180.0) + phase)))
  33.     end if
  34.     if the hilite of cast "Cosine" then
  35.       set the locV of sprite 19 to y0 - (field "A" * 50.0 * float(cos((float(period * n * 3.0) * PI / 180.0) + phase)))
  36.     end if
  37.     if the hilite of cast "Tangent" then
  38.       set the locV of sprite 19 to y0 - (field "A" * 50.0 * float(tan((float(period * n * 3.0) * PI / 180.0) + phase)))
  39.     end if
  40.     updateStage()
  41.   end repeat
  42. end
  43.  
  44. on mouseDown
  45.   button()
  46. end
  47.